import sys
import platform
sys.path.append('..')
from run_suite.suite import *
import time

if __name__ == '__main__':
    leader = Engine()
    leader1 = Engine()
    follower = Engine()
    leader.start('leader.cfg', 'leader')
    leader1.start('leader1.cfg', 'leader1')
    time.sleep(1)
    follower.start('follower.cfg', 'follower')
    time.sleep(1)
    follower.stop()
    leader.stop()
    leader1.stop()
    if checkLog('follower.log', 'Property::SiteDupPolicy::KeepOld [1-1-1]') and checkLog('leader1.log', 'Close reason:Apply SiteDupPolicy::KeepOld, 1-2-1<-X->1-1-1'):
        writeResult('multi_leader_keepold', 'pass')
    else:
        writeResult('multi_leader_keepold', 'fail', 'Site not joined')